package com.example.springboot2.oa.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.springboot2.oa.entity.TCustomer;
import com.example.springboot2.oa.mapper.TCustomerMapper;
import com.example.springboot2.oa.service.ITCustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author llfy
 * @since 2018-11-23
 */
@Service
public class TCustomerServiceImpl extends ServiceImpl<TCustomerMapper, TCustomer> implements ITCustomerService {

    @Autowired
    private TCustomerMapper customerMapper;

        @Override
    public Boolean getCustomerByName(TCustomer customer) {
        TCustomer tCustomer = customerMapper.getCustomerByCno(customer);
        if (tCustomer != null ){
            return true;
        }else{
            return false;
        }
    }

    @Override
    public TCustomer getCustomer(TCustomer customer) {
        return customerMapper.getCustomer(customer);
    }

    @Override
    public Boolean getCustomerByNameAndId(TCustomer customer) {
        TCustomer tCustomer = customerMapper.getCustomerByNameAndId(customer);
        if (tCustomer != null ){
            return false;
        }else{
            return true;
        }
    }

    @Override
    public List<TCustomer> listCustomer(String cname) {
        return customerMapper.listCustomer(cname);
    }
}
